﻿@{
    Layout = null;
    
}

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
    <meta name="format-detection" content="telephone=no,email=no">
    <title>培训公告</title>
    <!-- 基础css begin -->
    <link type="text/css" rel="stylesheet" href="/static/pkg/core.css">
    <!-- 基础css end -->
    <!-- 公用css begin -->
    <link type="text/css" rel="stylesheet" href="/static/pkg/combine.css?ver=20150716">
    <!-- 公用css end -->
    <style>
        #list .action-counts {
            float: none;
            text-align: initial;
        }

        .logo {
            /*height: 50px;*/
            /*background: url("/content/wuling/images/logo-big.png") no-repeat center center;*/
            /*background-size: auto 100%;*/
        }
    </style>
</head>
<body id="list">
    <img id="background-image" class="background-full" src="~/content/wuling/images/background.png" />
    <div id="wrapper">
        <div id="content">
            <header class="margin-bottom-0"  style="text-align:center;font-size:24px; font-weight:bolder;"><span>培训公告</span>
                <div class="logo"></div>
            </header>
            <section>
                <ul class="thread-list"></ul>
                <button id="btnMoreThread" type="button" class="button width-full margin-top-20" style="display: none;">更多</button>
            </section>
        </div>
    </div>
    <!-- 公用js begin -->
    <script type="text/javascript" charset="utf-8" src="/Content/wuling/pkg/js/core.js"></script>
    <script src="/Content/wuling/js/scroll/scrollpagination.js?ver=201512071548"></script>
    <script src="/Content/wuling/js/common.js?ver=201511261333"></script>
    <!-- 公用js begin -->
    <script type="text/javascript">
        // var userInfo = JSON.parse('');
        var pageIndex = 1;
        BindArticles(10);
        function BindArticles(pageSize) {
            pageSize = pageSize || 10;
            $(".thread-list").scrollPagination({
                contentData: {},
                scrollTarget: $(window),
                heightOffset: 10,
                beforeLoad: function (options) {
                    $("#loadingText").show();
                    options.contentPage = "/wuling/getarticlelist?categoryId=1025&pageIndex=" + pageIndex + "&pageSize=" + pageSize;
                },
                appendItems: function (objInvokeResult) {
                    $("#loadingText").hide();

                    if (objInvokeResult.ResultCode == "ArticleInfoNull") {
                        //todo：移除更多事件
                        $("#article_more").removeAttr("onclick");
                        $("#article_more").hide();
                        //停止滚动加载
                        $("#articlelist").stopScrollPagination();
                        return;
                    }
                    if (objInvokeResult.ResultCode != "Success") {
                        alert(objInvokeResult.ResultMessage);
                        return;
                    }
                    if (objInvokeResult.Data.length < pageSize) {
                        //停止滚动加载
                        $("#articlelist").stopScrollPagination();
                        $("#article_more").removeAttr("onclick");
                        $("#article_more").hide();
                    } else {
                        //$("#article_more").show();
                    }
                    var html = "";
                    $.each(objInvokeResult.Data, function (i, objArticleResultInfo) {
                        html += CreateArticleHtml(objArticleResultInfo);
                    });

                    $(".thread-list").append(html);

                    pageIndex++;
                },
                afterLoad: function (objInvokeResult) {

                }
            });
        }

        function CreateArticleHtml(objArticleResultInfo) {
            var html = "";
            if (typeof (objArticleResultInfo) == "undefined" || typeof (objArticleResultInfo.ArticleInfo) == "undefined") {
                return html;
            }
            var objArticleInfo = objArticleResultInfo.ArticleInfo;
            html =
                '<li onclick=\'window.location.href = "/wuling/article/thread-topic/' + objArticleInfo.ArticleId + '";\' data-id="' + objArticleInfo.ArticleId + '" data-bind="0">' +
                    '<div class="cfix">' +
                        '<div class="preview-image margin-right-10 fl" style="background-image: url(\'' + objArticleInfo.MinPic + '\')"></div>' +
                        '<div class="video-info">' +
                            '<div class="video-title">' + objArticleInfo.ArticleTitle + '</div>' +
                            '<div class="font-size-14">' + JsonToDate(objArticleResultInfo.ArticleInfo.ApproveDate, false) + '</div>' +
                           
                        '</div>' +
                    '</div>' +
                '</li>';
            return html;
        }
    </script>
</body>
</html>